async function rpcResult (ctx, method, path, query = null, body = null, serviceId = 'isubcontract-service') {
  method = method.toLowerCase()
  const invokers = {
    path,
    timeout: 30 * 1000
  }
  query && (invokers.query = query)
  if (['post', 'patch', 'put'].indexOf(method) > -1) invokers.body = body
  const result = await ctx.rpc[method](
    invokers,
    {
      serviceId
    }
  )
  return result
}

module.exports = {
  rpcResult
}
